<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="ajax.jsp"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<style>
    .header-top_nav {
        background-color: #f8f8f8;
        padding: 10px 0;
    }

    .header-block {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header_r {
        font-size: 14px;
    }

    #get_top {
        position: relative;
    }

    #logo {
        /*background: url(pic/logo.png) no-repeat;*/
        position: fixed;
        top: 140px;
        left: 0;
        width: 300px;
        height: 150px;
    }

    .header-mainNav {
        background-color: rgba(62, 66, 66, 0.62);
        color: #fff;
        padding: 10px 0;
    }

    .nav_list ul {
        list-style: none;
        display: flex;
    }

    .nav_list ul li {
        margin-right: 20px;
    }

    .search_box {
        display: flex;
        align-items: center;
    }

    a {
        width: 120px;
        height: 30px;
        cursor: pointer;
        text-decoration: underline;
    }

    a:hover {
        color: grey;
    }

    .nav_list a {
        color: #fff;
    }


</style>

<div class="header-top_nav">
    <div class="header-block">
        <ul class="top_bav_l">
        </ul>
        <div class="header_r">
            <font style="color: #666" id="ECS_MEMBERZONE">
                <c:if test="${user.token == null }">
                    <a id="loginTip" href="/user/loginPage">[用户登录]</a>&nbsp;
                    <a id="registerTip" href="/user/registerPage">[用户注册]</a>
                </c:if>
                <c:if test="${user.token != null }">
                    你好 <b>${user.username }</b>
                    <a onclick="navigateTo('/user/cart')">[购物车]</a>&nbsp;
                    <a onclick="navigateTo('/user/userCenter')">[用户中心]</a>&nbsp;
                    <a onclick="exitLogin()">[退出系统]</a>
                </c:if>
            </font>
        </div>
    </div>
</div>
<script>
    window.onload = function (){

    }
    //注销登录
    function exitLogin(){
        let flag = confirm('确认退出?');
        if (flag === true){
            localStorage.removeItem('userInfo');
            localStorage.removeItem('token');
            localStorage.removeItem('role');
            location.href = '/user/exit';
        }
    }
</script>
<div style="clear: both"></div>
<div class="header-mainNav">
    <div class="header-block nav_list">
        <ul style="color: #fff;">
            <li><a href="/user/index">首页</a></li>
            <c:forEach items="${bannerList}" var="banner">
                <li><a href="/index/article?id=${banner.bannerId}">${banner.bannerName }</a></li>
            </c:forEach>
            <li><a onclick="navigateTo('/user/recommend')">推荐商品</a></li>
            <li><a onclick="navigateTo('/user/special')">特价商品</a></li>
            <li><a onclick="navigateTo('/user/getAllGoods')">全部商品</a></li>
            <li><a onclick="navigateTo('/user/addComplain')">留言交流</a></li>
        </ul>
        		<div class="search_box">
        			<form id="searchForm" name="searchForm" method="post" action="index/query" style="width: 208px; height: 24px;">
        				<input name="name" type="text" id="keyword" value="" class="top_search_input" />
        				<input type="submit" class="search_bnt" value=" " style="vertical-align: middle;" />
        			</form>
        			<div style=""></div>
        		</div>
    </div>
</div>
